﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Hyt.Web.Mvc.Controls
{
    public class Buttons
    {
        public static String SubmitButton( string text, string ico="save")
        {
            string str = String.Format("<button type=\"submit\" class=\"button {1}\">{0}</button>", text, ico);
            return str;
        }

        public static String NavtabButton( string url, string text, string ico = "", string args = "")
        {
            string str = String.Format(" <a href=\"{0}\" target=\"navtab\" navtab=\"{2}\" class=\"button {3}\">{1}</a>",url, text,args, ico);
            return str;
        }

        public static String DialogButton( string url, string text, string ico = "", string args = "")
        {
            string str = String.Format(" <a href=\"{0}\" target=\"dialog\" dialog=\"{2}\" class=\"button {3}\">{1}</a>", url, text, args, ico);
            return str;
        }

        public static String AjaxpostformButton( string text, string ico = "", string args = "")
        {
            string str = String.Format(" <button target=\"ajaxpostform\" ajaxpostform=\"{1}\" class=\"button {2}\">{0}</button>", text, args, ico);
            return str;
        }

        public static String CalljsButton( string text, string ico = "", string args = "")
        {
            if (!args.Contains(":"))
            {
                args = "method:" + args;
            }
            string str = String.Format(" <a target=\"calljs\" calljs=\"{1}\" class=\"button {2}\">{0}</a>", text, args, ico);
            return str;
        }

    }
}
